"""
URL configuration for lyf_library project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from catalog import views # Import catalog views
from django.conf import settings # Import settings
from django.conf.urls.static import static # Import static
from django.conf.urls.i18n import i18n_patterns # Import i18n patterns
from django.views.i18n import set_language # Import set_language view
from django.contrib.auth import views as auth_views

urlpatterns = [
    path('i18n/setlang/', set_language, name='set_language'),
    path('books/batch-favorite/', views.batch_favorite, name='batch-favorite'),
    path('my-favorites/export-excel/', views.export_favorites_excel, name='export-favorites-excel'),
]

urlpatterns += i18n_patterns(
    path('accounts/password_reset/', auth_views.PasswordResetView.as_view(
        template_name='registration/password_reset_form.html'
    ), name='password_reset'),
    path('admin/', admin.site.urls),
    path('catalog/', include('catalog.urls')),
    path('accounts/', include('django.contrib.auth.urls')),
    path('accounts/register', views.register, name="register"),
    path('', views.home_page, name='home'), # New URL pattern for the root page
    prefix_default_language=False
)

# Serve media files in development
if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
